home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
028.dms
/
028.adf
/
Features_of_the_Shell
/
Wildcards
< prev
next >
Wrap
Text File
|
1992-02-26
|
4KB
|
87 lines
Wildcards
Wildcards are a special type of character that AmigaDOS uses to choose, for
example, multiple files. A wildcard can save you from typing a long
filename by typing in the first few letters then putting the wildcard #?.
This tells AmigaDOS that all commands beginning with the string you typed
are to be the argument you have passed. Wildcards are difficult to get to
grasps with at first (let's face it - so is AmigaDOS itself :-) but are well
worth using once you have learned them.
A few examples might help.
Am#? means any file beginning with Am and ending with any number of
characters are specified. In a practical situation, you could use this
command to copy all related files for a program to a destination. Say you
have the application program MakeDisk on your Workbench disk but would like
to copy it to another disk, MyDisk:. MakeDisk has also got three
accompanying files with it - MakeDiskB, MakeDisk.setup and MakeADisk.
To copy all three you will need to work out the place to cut off the
command. You could use M#? to copy all files beginning with M. But what
if you had a directory on your Workbench disk called Maths? If you used
the M#? argument that directory would also be copied. MakeDisk#? would copy
three of the files but the file MakeADisk would not be copied. So your best
bet would be to issue the command
Copy FROM Workbench2.0:Make#? TO MyDisk:
Now all four files will be copied, under their original names, to MyDisk:.
Of course, there are more wildcards. The rest of them are:
?
Is used to match any single character. B?D matches
any file with a name three letters long that begins
with B and ends with D. For example BAD, BED and
BID (if they were in the current directory) would be
matched. More than one can be used, either together
or apart. ??????? matches all filenames seven
letters long and H?L?O matches all filenames that
are five letters long, beginning with H, with an L
as the middle character and ending with O.
#<p>
Where <p> is replaced by any character(s). The
wildcard in the above example was formed by this
wildcard. What #<p> does is match zero or more
occurrences of <p>. This is a complicated command
with a lot of scope. Some examples are:
A#BC matches any character beginning with A,
ending with C and with any number of Bs
in between. SO some matches could be ABC,
ABBC or AC (AC is a match because it has no
Bs in it - remember, it checks for zero or
more occurrences, not one or more. #?
matches any character.
<p1>|<p2>
Matches either <p1> or <p2>. For example
File(A|B)name would match either FileAname
or FileBname.
~<p>
Matches everything except the text specified in <p>.
(~#?.doc) matches all files except files that end in
.doc (text files).
%
Matches the null string.
A(B|D|%)#C matches ABC, ADC, AC, ABCC, ADCC,
ACCC, etc.
If you have a filename containing one of the wildcard definition characters,
for example "NoSampler?" or "File#1" you will find it gets mistaken for a
wildcard definition. To avoid this, you must precede the guilty character
with an apostrophe ('). An example -
Copy FROM SYS:NoSampler? TO DF1:
This will copy the file NoSampler? to the disk in drive 1. It will also
copy files with names like NoSampler1, NoSamplers or NoSampler!. If you
only want the file "NoSampler?" copying you must use the line
Copy FROM SYS:NoSampler'? TO Df1:
Now only the file "NoSampler" is copied. The files like NoSampler1 will be
left untouched.